home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / gfxfx / plasma3.pas < prev    next >
Pascal/Delphi Source File  |  1994-06-22  |  2KB  |  102 lines

  1.  
  2. program plasma;
  3. uses
  4.   crt;
  5. const
  6.   vidseg:word=$a000;
  7.   border:boolean=false;
  8. var
  9.   stab:array[0..255] of byte;
  10.   address,x,y:word;
  11.   i1,i2,j1,j2,c:byte;
  12.  
  13. procedure setborder(col:byte); assembler; asm
  14.   xor ch,ch; mov cl,border; jcxz @out; mov dx,3dah; in al,dx
  15.   mov dx,3c0h; mov al,11h+32; out dx,al; mov al,col; out dx,al; @out: end;
  16.  
  17. procedure setpal(c,r,g,b:byte); assembler; asm
  18.   mov dx,3c8h; mov al,[c]; out dx,al; inc dx; mov al,[r]
  19.   out dx,al; mov al,[g]; out dx,al; mov al,[b]; out dx,al; end;
  20.  
  21. procedure retrace; assembler; asm
  22.   mov dx,3dah; @vert1: in al,dx; test al,8; jz @vert1
  23.   @vert2: in al,dx; test al,8; jnz @vert2; end;
  24.  
  25. procedure setaddress(ad:word); assembler; asm
  26.   mov dx,3d4h; mov al,0ch; mov ah,[byte(ad)+1]; out dx,ax
  27.   mov al,0dh; mov ah,[byte(ad)]; out dx,ax; end;
  28.  
  29. procedure doplasma; assembler;
  30. asm
  31.   mov es,vidseg
  32.  @run:
  33.   call retrace
  34.   add i1,1
  35.   add j1,1
  36.   mov si,5
  37.   mov ax,si
  38.   shl ax,6
  39.   mov di,ax
  40.   shl ax,4
  41.   add di,ax
  42.   add di,20
  43.  @l0:
  44.   xor bh,bh
  45.   mov bl,i1
  46.   add bx,si
  47.   and bx,$ff
  48.   mov dl,byte ptr stab[bx]
  49.   xor bh,bh
  50.   mov bl,j1
  51.   mov dh,byte ptr stab[bx]
  52.   mov cx,10
  53.  @l1:
  54.   mov bx,dx
  55.   add bx,cx
  56.   xor bh,bh
  57.   mov al,byte ptr stab[bx]
  58.   mov bx,dx
  59.   shr bx,8
  60.   add bx,si
  61.   xor bh,bh
  62.   add al,byte ptr stab[bx]
  63.   mov ah,al
  64.   mov [es:di],ax
  65.   add di,2
  66.   add ax,$1010
  67.   mov [es:di],ax
  68.   add di,318
  69.   mov [es:di],ax
  70.   sub ax,$1010
  71.   add di,2
  72.   mov [es:di],ax
  73.   sub di,318
  74.   inc cx
  75.   cmp cx,80
  76.   jne @l1
  77.   add di,360
  78.   inc si
  79.   cmp si,85
  80.   jne @l0
  81.   in al,$60
  82.   cmp al,$80
  83.   ja @run
  84. end;
  85.  
  86. begin
  87.   asm mov ax,13h; int 10h; end;
  88.  
  89.   for x:=0 to 63 do begin
  90.     setpal(x,x div 4,x div 2,x div 2);
  91.     setpal(127-x,x div 4,x div 2,x div 2);
  92.     setpal(127+x,x,x div 4,x div 2);
  93.     setpal(254-x,x,x div 4,x div 2);
  94.   end;
  95.   for x:=0 to 255 do stab[x]:=round(sin(2*pi*x/255)*128)+128;
  96.  
  97.   i1:=50; j1:=90; address:=0;
  98.   doplasma;
  99.  
  100.   textmode(lastmode);
  101. end.
  102.